let db = {
	save(key, value) {
		uni.setStorageSync(key, value);
	},
	get(key, defaultValue = {}) {
		const value = uni.getStorageSync(key);
		return  value || defaultValue
	},
	remove(key) {
		uni.removeStorageSync(key)
	},
	clear() {
		try {
			uni.clearStorageSync();
		} catch (e) {
			// error
		}
	},
	getSystemInfo() {
		return new Promise((resolve, reject) => {
			uni.getSystemInfo({
			    success: function (res) {
					resolve(res);
			        // console.log(res.model);
			        // console.log(res.pixelRatio);
			        // console.log(res.windowWidth);
			        // console.log(res.windowHeight);
			        // console.log(res.language);
			        // console.log(res.version);
			        // console.log(res.platform);
			    },
				fail(err) {
					resolve(err);
				}
			});
			 
		});
	}
}

export default db
